package com.sangfor.ssl.service.https;

import android.text.TextUtils;
import com.sangfor.bugreport.logger.Log;
import java.io.ByteArrayInputStream;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;

/* loaded from: classes2.dex */
public class SSLSession {
    private static final String TAG = "SSLSession";
    private String mMessageDigest;
    private String mX509;

    public SSLSession() {
    }

    public SSLSession(String str, String str2) {
        this.mX509 = str;
        this.mMessageDigest = str2;
    }

    public X509Certificate getX509Certificate() {
        if (TextUtils.isEmpty(this.mX509)) {
            Log.error(TAG, "mX509 is invalid");
            return null;
        }
        try {
            return (X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate(new ByteArrayInputStream(this.mX509.getBytes()));
        } catch (CertificateException e) {
            Log.error(TAG, "Create X509 cert fail.", e);
            return null;
        }
    }

    public String getMessageDigest() {
        return this.mMessageDigest;
    }
}
